﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MMOArpgServer.DAL
{
    interface ICachePool
    {
        /// <summary>
        /// 通过键值取得相对应的一个缓存对象。
        /// </summary>
        /// <param name="key">键值</param>
        /// <returns>缓存对象</returns>
        AbsCacheData GetCacheByKey(object key); 
        /// <summary>
        /// 通过缓存查询键值
        /// </summary>
        /// <param name="cache">缓存对象</param>
        /// <returns>缓存的键值</returns>
        object GetKeyByCache(AbsCacheData cache);
        /// <summary>
        /// 将缓存对象加入到缓存池中。
        /// </summary>
        /// <param name="key"></param>
        /// <param name="cache"></param>
        void AddCacheToPool(object key, AbsCacheData cache);
        /// <summary>
        /// 移除缓存
        /// </summary>
        /// <param name="key">缓存值</param>
        void RemoveCache(object key);
        /// <summary>
        /// 获取空闲资源
        /// </summary>
        /// <returns>空闲的资源</returns>
        AbsCacheData GetFreeCache();

        void Release();
    }
}
